<template>
	<view class="wrap">
		<view class="top">
			<view class="left">
				<view class="photo">
					<image :src="dataObj.avatar" mode=""></image>
				</view>
				<view class="info-wrap">
					<view class="name">{{dataObj.nick_name}}</view>
					<view class="account-t">
						会员账号
					</view>
					<view class="account">
						{{dataObj.username}}
					</view>
				</view>
			</view>
			<view class="right">
				<view class="weirenz" :class="{'yirenzheng':dataObj.is_real_name}">
					{{dataObj.is_real_name?'已认证':'未认证'}}
				</view>
				<view class="ma">
					邀请码：
				</view>
				<view>
					{{dataObj.invite_code}}
				</view>
			</view>
		</view>
		
		
		<view class="menu-wrap">
			<!-- <view class="item" @click="enterpage('../wodechanchumingxi/index')">
				<view class="img-wrap">
					<image src="../../static/chanchumingxi2.png" mode=""></image>
					
				</view>
				<view class="desc">
					产出明细
				</view>
			</view> -->
			<view class="item" @click="enterpage('../huazhuan/index')">
				<view class="img-wrap">
					<image src="../../static/huazhuan.png" mode=""></image>
					
				</view>
				<view class="desc">
					划转
				</view>
			</view>
			<!-- <view class="item" @click="enterpage('../wodetuandui/index')">
				<view class="img-wrap">
					<image src="../../static/tuandui.png" mode=""></image>
					
				</view>
				<view class="desc">
					我的团队
				</view>
			</view> -->
			<view class="item" @click="enterpage('../kefu/index')">
				<view class="img-wrap">
					<image src="../../static/kefu.png" mode=""></image>
					
				</view>
				<view class="desc">
					客服
				</view>
			</view>
		</view>
		<view class="list-wrap">
			<view class="item wodeguquan" @click="enterpage('../wodeguquan/index')">
				我的股权
			</view>
			<view  class="item shimingrenzheng" @click="enterpage('../shimingrenzheng/index')">
				实名认证
			</view>
			<view  class="item guquandaiqian" @click="enterpage('../guquandaiqian/index')">
				股权代签
			</view>
			<view class="item anquanshezhi" @click="enterpage('../anquanshezhi/index')">
				其他设置
			</view>
			<view class="item shouhuodizhi" @click="enterpage('../shouhuodizhi/index')">
				收货地址
			</view>
			<view class="item xinxiang" @click="enterpage('../xinxiang/index')">
				董事长信箱
			</view>
			<view class="item banbenhao" @click="getVersion">
				版本号：{{version}}
			</view>
			<!-- <view class="item banbenhao" @click="zhifu">
				支付
			</view> -->
		</view>
		<view class="log-out" @click="logout">
			退出登录
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				version:'',
				platform:'',
				dataObj: {
					is_real_name:true
				}
			}
		},
		onShow(){
			//this.getData()
		},
		onLoad() {
			this.version=this.VERSION
			this.getData()
			switch(uni.getSystemInfoSync().platform){
			    case 'android':
			
			      this.platform= 'android'
					
			       break;
			
			    case 'ios':
			        this.platform= 'ios'
			
			       break;
			
			    default:
			
			        this.platform= 'other'
			
			       break;
				  
			
			}
	
		},
		methods: {
			zhifu2(){
			//APP支付
			// #ifdef APP-PLUS
				uni.showLoading({title: '加载中',})
				uni.request({
				  url: getApp().globalData.https + '/wap.php/Order/pay_course_order',//支付订单接口链接
				  data: {
					oid:data.oid,//订单号
				  },
				  method: 'POST',
				  header: getApp().globalData.header,
				  dataType: 'json',  
				  success: function (res) {
					var data = res.data;
					if(data.status == 1){
						uni.requestPayment({
							provider: 'wxpay',//微信支付
							orderInfo: {
								"appid": data.data.appid,
								"noncestr": data.data.noncestr,
								"package": "Sign=WXPay",
								"partnerid": data.data.partnerid,
								"prepayid": data.data.prepayid,
								"timestamp": data.data.timestamp,
								"sign": data.data.sign
							},
							success: function (res) {
								setTimeout(function () {uni.hideLoading();}, 100);
								uni.showLoading({
								  title: '跳转中',
								})
								setTimeout(() => {
								 	uni.redirectTo({
								 	    url: '/pages/user/order_list'
								 	});
								}, 1000);
							},
							fail: function (err) {
								uni.redirectTo({
								    url: '/pages/user/order_list?'
								});
							},
						})
					}
					if(data.status == 0){
						uni.showToast({
							title: data.msg,
							icon: "none"
						});
						return false;
					}
				  }
				})
				// #endif
			},
			zhifu(){
				
				const params = JSON.stringify({
					appid:'wx7d260a0dc54c289d', 
					noncestr: 'val.nonceStr', 
					package:'Sign=WXPay', 
					partnerid:'1111111', 
					prepayid: 'val.prepayID', 
					timestamp: 'val.timeStamp',
					sign: 'val.paySign', 
				 })
				uni.requestPayment({
				    provider: 'wxpay',
				    orderInfo: params, //微信、支付宝订单数据 【注意微信的订单信息，键值应该全部是小写，不能采用驼峰命名】
				    success: function (res) {
				        console.log('success:' + JSON.stringify(res));
				    },
				    fail: function (err) {
				        console.log('fail:' + JSON.stringify(err));
				    }
				});
			},
			getData(){
				let that=this
				
				that.apipost('/api/user/index').then(res => {
					if(res.Code==10200){
						that.dataObj=res.Data
					}
					
				}).catch(err=>{
					console.log(err)
				});
			},
			logout(){
				let that=this
				uni.showModal({
				    title: '确定退出？',
				    content: '',
				    success: function (res) {
				        if (res.confirm) {
							
							that.apipost('/api/auth/logout',{
								mobile:uni.getStorageSync("mobile")
							},true).then(res => {
								if(res.Code==10200){
									// uni.showToast({
									//     title: res.Message,
									//     duration:4000,
									// 	icon:'none'
									// });
								}
								
							}).catch(err=>{
								console.log(err)
							});
							uni.clearStorageSync();
							uni.reLaunch({
								url: '../login/index'
							});
				           
				        } else if (res.cancel) {
				            
				        }
				    }
				});
				//enterpage('../login/index')
			},
			doUpData(url) {
			  uni.showToast({
			      title: '更新完成将自动安装',
			      duration:4000,
			  	icon:'none'
			  });
			    uni.downloadFile({//执行下载
			        url: url, //下载地址
			        success: downloadResult => {//下载成功
			          
			            if (downloadResult.statusCode == 200) {
			               plus.runtime.install(//安装
			                   downloadResult.tempFilePath, {
			                       force: true
			                   },
			                   function(res) {
			               		uni.showToast({
			               		    title: '更新成功，即将重启',
			               		    duration:4000,
			               			icon:'none'
			               		});
			                       setTimeout(function(){
									   plus.runtime.restart();
								   },4000)
			                       
			                   }
			               );
			            }
			        }
			    });
			},
			
			enterpage(path,type){
				if(path){
					switch(type){
						case 1:
							uni.navigateTo({
								url: path+`?src=${this.dataObj.about_us}`
							});
						break;
						default:
						uni.navigateTo({
						    url: path
						});
					}
				}else{
					uni.showToast({
					    title: '暂未开放',
					    duration:4000,
						icon:'none'
					});
				}
			}
		}
	}
</script>

<style>
	
	
	.list-wrap .item{
		border-bottom:2rpx solid #f7f7f7;
		display:flex;
		align-items: center;
		padding-left:104rpx;
		height:130rpx;
	}
	.log-out{
		display:flex;
		height:100rpx;
		background:#fff;
		width:690rpx;
		justify-content: center;
		align-items: center;
		
		color:#ff9d4f;
		margin:24rpx auto;
		border-radius:20rpx;
	}
	.list-wrap{
		background:#fff;
		width:690rpx;
		margin:0 auto;
		border-radius:20rpx;
	}
	.menu-wrap{
		display:flex;
		margin:0 auto;
		text-align: center;
		width:642rpx;
		justify-content: space-around;
		align-items: center;
		margin-top:30rpx;
		padding-bottom:50rpx;
	}
	.menu-wrap .img-wrap{
		width:94rpx;
		margin:0 auto;
		height:94rpx;
		display:flex;
		
	}
	img{
		height:100%;
		width:100%;
	}
	.yirenzheng{
		color:#486def!important;
		background:#fff url(../../static/yirenzhengwode.png) no-repeat  12rpx center!important;
		background-size:30rpx auto!important;
		/* background:#486def!important; */
		
	}
	.top .weirenz{
		position:absolute;
		right:-12rpx;
		top:-48rpx;
		color:#767676;
		border-radius:99rpx;
		width:198rpx;
		height:54rpx;
		display:flex;
		align-items: center;
		box-sizing: border-box;
		padding-left:70rpx;
		background:#c4c4c4 url(../../static/weirenz.png) no-repeat  12rpx center;
		background-size:40rpx auto;
	}
	.top .right{
		padding-top:30rpx;
		position:relative;
		color:#767676;
		border-left:1rpx solid #c2c2c2;
		margin-top:60rpx;
		width:254rpx;
		padding-left:20rpx;
	}
	.top .name{
		padding-bottom:12rpx;
		font-size:34rpx;
	}
	.top .account-t{
		color:#767676;
		padding-bottom:12rpx;
		font-size:26rpx;
	}
	.top .account{
		color:#767676;
		padding-bottom:18rpx;
		font-size:26rpx;
	}
	.top{
		display: flex;
		width:100%;
		overflow: hidden;
		justify-content: space-between;
	}
	.top .left{
		padding-top:30rpx;
		padding-left:60rpx;
		display: flex;
		justify-content: space-between;
	}
	.top .left .photo{
		
		height:120rpx;
		width:120rpx;
		border-radius: 50%;
		margin-right:16rpx;
		display: flex;
		justify-content: space-between;
	}
	.wrap{
		background:#f7f7f7;
		height:100%;
		padding-bottom:10rpx;
		box-sizing: border-box;
		overflow: auto;
	}
	.guquandaiqian{
		background:url(../../static/guquandaiqian.png) no-repeat 40rpx center  !important;
		background-size:70rpx auto!important;
	}
	.shimingrenzheng{
		background:url(../../static/shimingrenz.png) no-repeat 40rpx center  !important;
		background-size:70rpx auto!important;
		
	}
	.anquanshezhi{
		background:url(../../static/anquanshezhi.png) no-repeat 40rpx center  !important;
		background-size:70rpx auto!important;
		
	}
	.wodeguquan{
		background:url(../../static/guquanitem.png) no-repeat 56rpx center  !important;
		background-size:38rpx auto!important;
		
	}
	.xinxiang{
		background:url(../../static/xinxiang.png) no-repeat 56rpx center  !important;
		background-size:38rpx auto!important;
	}
	.shouhuodizhi{
		background:url(../../static/dizhiitem.png) no-repeat 56rpx center  !important;
		background-size:38rpx auto!important;
		
	}
	.banbenhao{
		background:url(../../static/banbenhaobg.png) no-repeat 56rpx center  !important;
		background-size:38rpx auto!important;
	}

</style>
